package cn.sumpu.app.guoguojie.biz.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import cn.sumpu.app.guoguojie.biz.TagBiz;
import cn.sumpu.app.guoguojie.dao.TagDao;
import cn.sumpu.app.guoguojie.domain.Tag;
import cn.sumpu.app.guoguojie.exception.AppBusinessException;

public class TagBizImpl implements TagBiz {

	private TagDao tagDao;

	public void setTagDao(TagDao tagDao) {
		this.tagDao = tagDao;
	}

	@Override
	public void insertTag(Tag tag) throws AppBusinessException {
		tagDao.insertTag(tag);
	}

	@Override
	public void deleteTag(Tag tag) throws AppBusinessException {
		tagDao.deleteTag(tag);
	}

	@Override
	public void updateTag(Tag tag) throws AppBusinessException {
		tagDao.updateTag(tag);
	}

	@Override
	public List<Tag> getTagList(Map<String, Object> map)
			throws AppBusinessException {
		return tagDao.getTagList(map);
	}

	@Override
	public List<Tag> getTagByDoorplate(String doorplate, Integer page)
			throws AppBusinessException {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("family", doorplate);
		if(page==null){
			page = 1;
		}
		//每页显示多少条
		int pageSize = 20;
		//从第几条开始
		int startId = (page-1)*pageSize;
		map.put("pageSize", pageSize);
		map.put("startId",startId);
		return tagDao.getTagByDoorplate(map);
	}

	@Override
	public Integer getTagByDoorplateCount(String doorplate)
			throws AppBusinessException {
		return tagDao.getTagByDoorplateCount(doorplate);
	}



}
